package com.lkd.handler;

import com.lkd.business.MsgHandler;
import com.lkd.common.VMSystem;
import com.lkd.config.TopicConfig;
import com.lkd.contract.VendoutResultContract;
import com.lkd.emq.Topic;

import com.lkd.entity.OrderEntity;
import com.lkd.utils.JsonUtil;
import org.springframework.stereotype.Component;

import java.io.IOException;


@Component
@Topic(TopicConfig.VMS_RESULT_TOPIC)
public class VendoutResultHandler implements MsgHandler {


    @Override
    public void process(String jsonMsg) throws IOException {
          //1-解析数据
        VendoutResultContract resultContract = JsonUtil.getByJson(jsonMsg, VendoutResultContract.class);
        //如果支付成功，则修改订单状态为发货完成
       if(resultContract.isSuccess());{
            OrderEntity orderEntity = new OrderEntity();
            orderEntity.setStatus(VMSystem.ORDER_STATUS_VENDOUT_SUCCESS);
        }

    }
}
